<template>
  <div class="box">
    <p class="title">查看订单</p>
    <el-form :label-position="labelPosition" label-width="80px">
      <el-form-item label="订单号">
        <span>{{detail.orderNo}}</span>
      </el-form-item>
      <el-form-item label="创建时间">
        <span>{{detail.createTime}}</span>
      </el-form-item>
      <el-form-item label="收件人">
        <span>{{detail.receiverName}},{{detail.shippingVo.receiverProvince}}{{detail.shippingVo.receiverCity}},{{detail.shippingVo.receiverAddress}}</span>
      </el-form-item>
      <el-form-item label="订单状态">
        <span>{{detail.statusDesc}}</span>
      </el-form-item>
      <el-form-item label="支付方式">
        <span>{{detail.paymentTypeDesc}}</span>
      </el-form-item>
      <el-form-item label="订单金额">
        <span>{{detail.orderNo}}</span>
      </el-form-item>
    </el-form>
    <table class="table" border="1px solid" cellspacing="0px" width="80%">
      <thead>
        <th>
          <tr>商品图片</tr>
        </th>
        <th class="c1">
          <tr>商品信息</tr>
        </th>
        <th>
          <tr>单价</tr>
        </th>
        <th>
          <tr>数量</tr>
        </th>
        <th>
          <tr>合计</tr>
        </th>
      </thead>
      <tbody>
        <td>
          <tr>
            <img :src="'http://img.happymmall.com/'+detail.orderItemVoList[0].productImage" alt />
          </tr>
        </td>
        <td class="c1">
          <tr>{{detail.orderItemVoList[0].productName}}</tr>
        </td>
        <td>
          <tr>￥{{detail.orderItemVoList[0].totalPrice}}</tr>
        </td>
        <td>
          <tr>{{detail.orderItemVoList[0].quantity}}</tr>
        </td>
        <td>
          <tr>{{detail.orderItemVoList[0].currentUnitPrice}}</tr>
        </td>
      </tbody>
    </table>
  </div>
</template>

<script>
import { detail } from "@/request/http";
export default {
  name: "detail",
  data() {
    return {
      labelPosition: "left",
      orderNo: "",
      detail: ""
    };
  },
  methods: {
    getList() {
      detail(this.orderNo).then(res => {
        console.log(res);
        this.detail = res.data.data;
        console.log(this.detail);
      });
    }
  },
  mounted() {
    this.orderNo = this.$route.query.orderNo;
    this.getList();
  }
};
</script>

<style lang="scss" scoped>
* {
  margin: 0;
  padding: 0;
}
.box {
  width: 100%;
  height: 100%;
  .title {
    width: 100%;
    height: 8%;
    font-size: 40px;
    .btn {
      width: 10%;
      height: 60%;
      float: right;
    }
  }
  .el-form{
      width: 50%;
      height: 50%;
      margin-left: 70px;
      font-weight: 900;
      font-size: 18px;
      .el-form-item{
          width: 100%;
          height: 15%;
          span{
              width: 80%;
              height: 80%;
              display: block;
              background: white;
              text-align: center;
          }
      }
  }
  .table {
    width: 70%;
    border: 1px solid black;
    box-sizing: border-box;
    height: 136px;
    margin-top: 80px;
  }
  .table thead {
    width: 100%;
    height: 40px;
    display: flex;
  }
  .table thead th {
    flex: 1;
    height: 100%;
    border-right:none;
    border-bottom:none;
    padding-left: 5px;
  }
  .table thead th tr {
    width: 100%;
    height: 100%;
    line-height: 40px;
  }
  .table tbody {
    width: 100%;
    height: 96px;
    display: flex;
  }
  .table tbody td {
    flex: 1;
    height: 100%;
    border-right:none;
    border-bottom:none;
  }
  .table tbody td tr {
    width: 100%;
    height: 100%;
  }
  .table tbody td tr:nth-of-type(1) {
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .table tbody td tr img {
    width: 70%;
    height: 80%;
  }
}
</style>